adc28 2.2.0
Loading...
Searching...
No Matches
ADC 28 Click Driver

API for configuring and manipulating ADC 28 Click driver. More...

Topics

 ADC 28 Registers List
 List of registers of ADC 28 Click driver.
 ADC 28 Registers Settings
 Settings for registers of ADC 28 Click driver.
 ADC 28 MikroBUS Map
 MikroBUS pin mapping of ADC 28 Click driver.

Functions

void adc28_cfg_setup (adc28_cfg_t *cfg)
 ADC 28 configuration object setup function.
err_t adc28_init (adc28_t *ctx, adc28_cfg_t *cfg)
 ADC 28 initialization function.
err_t adc28_default_cfg (adc28_t *ctx)
 ADC 28 default configuration function.
err_t adc28_write_reg (adc28_t *ctx, uint8_t reg, uint8_t data_in)
 ADC 28 write register function.
err_t adc28_write_regs (adc28_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 ADC 28 write registers function.
err_t adc28_read_reg (adc28_t *ctx, uint8_t reg, uint8_t *data_out)
 ADC 28 read register function.
err_t adc28_read_regs (adc28_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 ADC 28 read registers function.
uint8_t adc28_get_alert_pin (adc28_t *ctx)
 ADC 28 get alert pin function.
err_t adc28_set_high_threshold (adc28_t *ctx, uint8_t channel, uint16_t high_th)
 ADC 28 set high threshold function.
err_t adc28_set_low_threshold (adc28_t *ctx, uint8_t channel, uint16_t low_th)
 ADC 28 set low threshold function.
err_t adc28_set_hysteresis (adc28_t *ctx, uint8_t channel, uint8_t hysteresis)
 ADC 28 set hysteresis function.
err_t adc28_set_event_count (adc28_t *ctx, uint8_t channel, uint8_t event_count)
 ADC 28 set event count function.
err_t adc28_read_raw_adc (adc28_t *ctx, uint8_t channel, uint16_t *raw_data)
 ADC 28 read raw ADC function.
err_t adc28_read_voltage (adc28_t *ctx, uint8_t channel, float *voltage)
 ADC 28 read voltage function.

Detailed Description

API for configuring and manipulating ADC 28 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ adc28_cfg_setup()

void adc28_cfg_setup ( adc28_cfg_t * cfg)

ADC 28 configuration object setup function.

This function initializes Click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See adc28_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ adc28_default_cfg()

err_t adc28_default_cfg ( adc28_t * ctx)

ADC 28 default configuration function.

This function executes a default configuration of ADC 28 Click board.

Parameters
[in]ctx: Click context object. See adc28_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ adc28_get_alert_pin()

uint8_t adc28_get_alert_pin ( adc28_t * ctx)

ADC 28 get alert pin function.

This function returns the logic state of the ALT (ALERT) pin.

Parameters
[in]ctx: Click context object. See adc28_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ adc28_init()

err_t adc28_init ( adc28_t * ctx,
adc28_cfg_t * cfg )

ADC 28 initialization function.

This function initializes all necessary pins and peripherals used for this Click board.

Parameters
[out]ctx: Click context object. See adc28_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See adc28_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adc28_read_raw_adc()

err_t adc28_read_raw_adc ( adc28_t * ctx,
uint8_t channel,
uint16_t * raw_data )

ADC 28 read raw ADC function.

This function reads the RAW ADC measurement.

Parameters
[in]ctx: Click context object. See adc28_t object definition for detailed explanation.
[in]channel: Channel selection.
[out]raw_data: Pointer to the raw ADC result [0, 4095].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adc28_read_reg()

err_t adc28_read_reg ( adc28_t * ctx,
uint8_t reg,
uint8_t * data_out )

ADC 28 read register function.

This function reads a single byte of data from the selected register.

Parameters
[in]ctx: Click context object. See adc28_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Pointer to the output data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adc28_read_regs()

err_t adc28_read_regs ( adc28_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

ADC 28 read registers function.

This function reads a sequential block of data starting from the selected register.

Parameters
[in]ctx: Click context object. See adc28_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Pointer to the output data buffer.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adc28_read_voltage()

err_t adc28_read_voltage ( adc28_t * ctx,
uint8_t channel,
float * voltage )

ADC 28 read voltage function.

This function reads the ADC result from the selected channel and converts it to a voltage level.

Parameters
[in]ctx: Click context object. See adc28_t object definition for detailed explanation.
[in]channel: Channel selection.
[out]voltage: Pointer to the output voltage.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adc28_set_event_count()

err_t adc28_set_event_count ( adc28_t * ctx,
uint8_t channel,
uint8_t event_count )

ADC 28 set event count function.

This function sets the number of consecutive threshold crossings required before the ALERT flag is set for the selected channel. ALERT triggers after event_count + 1 crossings.

Parameters
[in]ctx: Click context object. See adc28_t object definition for detailed explanation.
[in]channel: Channel selection.
[in]event_count: Event count value [0, 15].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adc28_set_high_threshold()

err_t adc28_set_high_threshold ( adc28_t * ctx,
uint8_t channel,
uint16_t high_th )

ADC 28 set high threshold function.

This function sets the high threshold for the selected channel.

Parameters
[in]ctx: Click context object. See adc28_t object definition for detailed explanation.
[in]channel: Channel selection.
[in]high_th: High threshold 12-bit raw ADC value [0, 4095].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adc28_set_hysteresis()

err_t adc28_set_hysteresis ( adc28_t * ctx,
uint8_t channel,
uint8_t hysteresis )

ADC 28 set hysteresis function.

This function sets the hysteresis for the selected channel. The actual hysteresis applied by the device is the written value multiplied by 8 LSBs.

Parameters
[in]ctx: Click context object. See adc28_t object definition for detailed explanation.
[in]channel: Channel selection.
[in]hysteresis: Hysteresis value [0, 15].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adc28_set_low_threshold()

err_t adc28_set_low_threshold ( adc28_t * ctx,
uint8_t channel,
uint16_t low_th )

ADC 28 set low threshold function.

This function sets the low threshold for the selected channel.

Parameters
[in]ctx: Click context object. See adc28_t object definition for detailed explanation.
[in]channel: Channel selection.
[in]low_th: Low threshold 12-bit raw ADC value [0, 4095].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adc28_write_reg()

err_t adc28_write_reg ( adc28_t * ctx,
uint8_t reg,
uint8_t data_in )

ADC 28 write register function.

This function writes a desired data word to the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See adc28_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data word to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adc28_write_regs()

err_t adc28_write_regs ( adc28_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

ADC 28 write registers function.

This function writes a sequential block of data starting from the selected register.

Parameters
[in]ctx: Click context object. See adc28_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Pointer to the input data buffer.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.